package com.edu.edu.week_project01.activity.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import com.edu.edu.week_project01.R;
import com.edu.edu.week_project01.activity.Configs;

public class MainActivity extends AppCompatActivity {

    private TextView tvMsg;
    private EditText tvUrl;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        tvMsg = (TextView) findViewById(R.id.tvMsg);
        tvUrl = (EditText) findViewById(R.id.tvUrl);
    }

    //获取系统当前时间
    public void getSystemTime(View view) {
        String newUrl = getSystemTime.getTime(Configs.JSON_URL_LIVE);
        tvUrl.setText(newUrl);
        Log.i("TAG",newUrl);
    }
    //跳转到详情页面
    public void detail(View view) {
        startActivity(new Intent(this,LiveDetailActivity.class));
    }
    //跳转到搜索页面
    public void search(View view) {
        startActivity(new Intent(this,SearchActivity.class));
    }
    //跳转到登录页面
    public void dropLogin(View view) {
        startActivity(new Intent(this,LoginActivity.class));
    }
    //跳转到轮播页面
    public void LbActivity(View view) {
        startActivity(new Intent(this,LbActivity.class));
    }
    //跳转到栏目页面
    public void Load(View view) {
        startActivity(new Intent(this,ProgrameActivity.class));
    }
    //跳转到ddd页面
    public void LoadWebview(View view) {
        startActivity(new Intent(this,WebActivity.class));
    }

    //字符串转换
    public void getStringCount(View view) {
        String content = tvUrl.getText().toString().trim();
        int conut = content.length() - 4;
        if(content.length() >= 5){
            tvMsg.setText(content.substring(0,conut) + "." + content.substring(conut,conut+1) + "万");
        }else {
            tvMsg.setText(content);
        }
    }
}
